import { reactive } from 'vue';
import type { TableColumn } from '@/components/core/dynamic-table';
import { selectDictLabel } from '@/utils/telchina';

export type TableListItem = API.ManageListResultItem;
export type TableColumnItem = TableColumn<TableListItem>;
export const pageDataObj = reactive({
  manufacturerDict: [],
});
export const baseColumns: TableColumnItem[] = [
  {
    title: '厂商',
    align: 'center',
    dataIndex: 'manufacturer',
    formItemProps: {
      colProps: {
        span: 6,
      },
      component: 'Select',
      componentProps: {
        options: pageDataObj.manufacturerDict,
      },
    },
    customRender: ({ record }) => {
      return selectDictLabel(pageDataObj.manufacturerDict, record.manufacturer);
    },
  },
  {
    title: '型号',
    align: 'center',
    dataIndex: 'equipmentType',
  },
  {
    title: '水表的类型',
    align: 'center',
    dataIndex: 'metersType',
  },
  {
    title: '挂表型号',
    align: 'center',
    dataIndex: 'installMetersType',
  },
  {
    title: '口径',
    align: 'center',
    dataIndex: 'caliber',
  },
  {
    title: '采集间隔',
    align: 'center',
    dataIndex: 'collectInterval',
  },
  {
    title: '超时时间s',
    align: 'center',
    dataIndex: 'timeoutTime',
  },
  {
    title: '描述',
    align: 'center',
    dataIndex: 'description',
  },
];
